Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support updating existing documents #430

Merged
merged 9 commits into from
Nov 7, 2024
Merged

feat: support updating existing documents #430

merged 9 commits into from
Nov 7, 2024

Conversation

IcyKallen
Copy link
Contributor

@IcyKallen IcyKallen commented Nov 6, 2024

Fixes #

🤖 AI-Generated PR Description (Powered by Amazon Bedrock)

Description

This pull request refactors the ETL (Extract, Transform, Load) process for managing chatbot executions and notifications. The main changes include:

  • Removed individual lambda functions for creating, deleting, listing, and getting the status of chatbot executions.
  • Added a new lambda function execution_management.py to handle all execution-related operations.
  • Modified notification.py to integrate with the new execution management process.
  • Updated the frontend components AddLibrary.tsx and Library.tsx to work with the new backend changes.
  • Modified the locale files en.json and zh.json to reflect the updated user interface strings.
  • Updated the API stack definition in api-stack.ts to include the new lambda function.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

File Stats Summary

File number involved in this PR: 15, unfold to see the details:

The file changes summary is as follows:

Files
Changes
Change Summary
source/lambda/etl/create_chatbot.py 0 added, 103 removed This file is removed in this PR
source/lambda/etl/delete_execution.py 0 added, 139 removed This file is removed in this PR
source/lambda/etl/get_execution.py 0 added, 49 removed This file is removed in this PR
source/lambda/etl/get_status.py 0 added, 47 removed This file is removed in this PR
source/lambda/etl/list_chatbot.py 0 added, 55 removed This file is removed in this PR
source/lambda/etl/list_execution.py 0 added, 110 removed This file is removed in this PR
source/portal/src/types/index.ts 2 added, 0 removed The code changes add two new properties, indexId and tag, to the LibraryListItem type definition.
source/lambda/etl/constant.py 1 added, 1 removed The code change adds a new enum value 'UPDATING' to the ExecutionStatus enum class.
source/portal/src/pages/components/AddLibrary.tsx 66 added, 13 removed This code change adds functionality to update an existing knowledge base execution, in addition to creating a new one. It includes logic to pre-populate form fields with existing execution details when in update mode, disables certain fields during update, and modifies the API request accordingly.
source/portal/src/locale/en.json 3 added, 0 removed The code changes add new keys for "update" and "updating" in the localization file, and add an "Update" button in the UI for managing chatbots.
source/lambda/etl/execution_management.py 358 added, 0 removed This code update introduces a Lambda function for managing execution pipelines and associated documents. It provides REST API endpoints for CRUD operations on execution pipelines, handling document management in DynamoDB and OpenSearch. The code includes classes for centralized AWS resource management, configuration constants, pagination configuration, authorization helper, execution manager, API response handling, and API endpoint handlers.
source/infrastructure/lib/api/api-stack.ts 11 added, 26 removed The code changes involve consolidating multiple Lambda functions related to execution management into a single Lambda function called "ExecutionManagementLambda". It also updates the API Gateway integration to use this new Lambda function for various execution-related operations like listing, getting, deleting, and potentially updating executions.
source/lambda/etl/notification.py 11 added, 3 removed This code change introduces a new function get_execution_item to retrieve the current execution item from DynamoDB, checks the current execution status before updating, and updates the execution status based on the operation type and current execution status.
source/portal/src/locale/zh.json 3 added, 0 removed This code change adds Chinese translations for the words "update" and "updating" to the language file, and adds an "update" button or option in the user interface related to chatbots or prompts.
source/portal/src/pages/library/Library.tsx 30 added, 12 removed The code changes include adding a ButtonDropdown component with options to update or delete selected items, adding an 'UPDATING' status indicator, handling update functionality in the add/edit modal, and refactoring the delete confirmation modal and related logic.
🤖 AI-Generated PR Description (Powered by Amazon Bedrock)

Description

This pull request refactors the ETL (Extract, Transform, Load) process for managing chatbot executions. The main changes include:

  • Removed individual Lambda functions for creating, deleting, listing, and getting the status of chatbot executions
  • Added a new Lambda function execution_management.py to handle all execution-related operations
  • Updated the notification module to work with the new execution management approach
  • Modified the frontend components and localization files to accommodate the changes in the backend

The motivation behind this change is to simplify the codebase, improve maintainability, and enhance the overall developer experience. By consolidating the execution-related operations into a single Lambda function, we can streamline the code and make it easier to manage and extend in the future.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

File Stats Summary

File number involved in this PR: 15, unfold to see the details:

The file changes summary is as follows:

Files
Changes
Change Summary
source/lambda/etl/create_chatbot.py 0 added, 103 removed This file is removed in this PR
source/lambda/etl/delete_execution.py 0 added, 139 removed This file is removed in this PR
source/lambda/etl/get_execution.py 0 added, 49 removed This file is removed in this PR
source/lambda/etl/get_status.py 0 added, 47 removed This file is removed in this PR
source/lambda/etl/list_chatbot.py 0 added, 55 removed This file is removed in this PR
source/lambda/etl/list_execution.py 0 added, 110 removed This file is removed in this PR
source/lambda/etl/constant.py 1 added, 1 removed The code change adds a new enum value "UPDATING" to the ExecutionStatus Enum class.
source/portal/src/types/index.ts 2 added, 0 removed The code change adds two new properties, 'indexId' and 'tag', to the 'LibraryListItem' interface in TypeScript.
source/portal/src/locale/zh.json 3 added, 0 removed This code change adds translations for the words "update" and "updating" to the Chinese language file, and adds an "update" option to the actions menu in the user interface.
source/infrastructure/lib/api/api-stack.ts 11 added, 26 removed The code changes consolidate multiple Lambda functions for managing ETL executions into a single Lambda function called "ExecutionManagementLambda". It also updates the API Gateway integration and adds a new PUT method for the "/kb-execution/{executionId}" resource.
source/lambda/etl/notification.py 11 added, 3 removed The code changes introduce a new function get_execution_item to retrieve an execution item from DynamoDB, and modify the lambda_handler to check the current execution status before updating it to DELETED status, ensuring it only happens when the current status is DELETING.
source/portal/src/pages/library/Library.tsx 30 added, 12 removed The code changes include adding a ButtonDropdown component for update and delete actions, adding an 'UPDATING' status indicator, adding an 'isUpdate' state to handle update functionality in the AddModal component, and refactoring the delete confirmation modal and related logic.
source/portal/src/locale/en.json 3 added, 0 removed The code changes add new translation keys for "update" and "updating" actions, and add an "Update" button to the Chatbot management interface.
source/lambda/etl/execution_management.py 358 added, 0 removed This code is a Lambda function for managing execution pipelines and associated documents. It provides REST API endpoints for CRUD operations on execution pipelines, handling document management in DynamoDB and OpenSearch. The code includes functionality for retrieving, updating, and deleting executions, as well as fetching associated objects from DynamoDB. It also includes pagination, authentication, and error handling mechanisms.
source/portal/src/pages/components/AddLibrary.tsx 71 added, 13 removed The code changes introduce an update functionality for an existing knowledge base execution. It adds props to handle a selected item and determine if it's an update operation. It fetches existing execution details, populates the form fields, and updates the API call accordingly (PUT instead of POST). Additionally, it disables certain form fields during an update.

@NingLu NingLu merged commit f99df77 into dev Nov 7, 2024
6 checks passed
@IcyKallen IcyKallen deleted the xuhan-dev branch November 27, 2024 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants